<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:bi="http://java.sun.com/jsf/composite/inward/bill"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">
                <h:form>
                    <p:panel header="Reprint" styleClass="alignTop" >
                        <h:panelGrid columns="2">
                            <h:outputLabel value="From Date"/>
                            <p:calendar  id="fromDate" value="#{bhtSummeryFinalizedController.fromDate}"  pattern="dd MMMM yyyy hh mm ss a" >
                            </p:calendar>
                            <h:outputLabel value="To Date"/>
                            <p:calendar  id="toDate" value="#{bhtSummeryFinalizedController.toDate}"  pattern="dd MMMM yyyy hh mm ss a" >
                            </p:calendar>
                            <h:outputText value="Inward Charge Category" ></h:outputText>
                            <p:selectOneMenu id="cmbInward" value="#{bhtSummeryFinalizedController.inwardChargeType}" >
                                <f:selectItem itemLabel="Please select Charge"/>
                                <f:selectItems value="#{enumController.inwardChargeTypesForSetting}" var="i" itemLabel="#{i.label}" itemValue="#{i}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>

                        <p:panelGrid columns="3">
                            <p:commandButton value="Search" ajax="false" action="#{bhtSummeryFinalizedController.createBhtInwardChargeTypeTable()}" />
                            <p:commandButton value="Print" ajax="false" action="#" >
                                <p:printer target="gpBillPreview" ></p:printer>
                            </p:commandButton>

                            <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" style="float: right;" onclick="onSubmitButton();"  >
                                <p:dataExporter type="xlsx" target="tbl" fileName="Inward_report"  ></p:dataExporter>
                            </p:commandButton>  
                        </p:panelGrid>


                    </p:panel>

                    <p:panel id="gpBillPreview">
                        <p:dataTable value="#{bhtSummeryFinalizedController.billItemsInward}" var="bip" id="tbl"
                                     >
                            <f:facet name="header">
                                <h:outputLabel value="Bill Items"/>
                            </f:facet>
                            <p:column headerText="BHT No">
                                <f:facet name="header">
                                    <h:outputLabel value="BHT No"/> 
                                </f:facet>
                                <h:outputLabel   value="#{bip.bill.patientEncounter.bhtNo}"/>
                            </p:column>
                            
                            <p:column headerText="Invoice No">
                                <f:facet name="header">
                                    <h:outputLabel value="Invoice No"/> 
                                </f:facet>
                                <h:outputLabel   value="#{bip.bill.insId}"/>
                            </p:column>

                            <p:column headerText="Discharge Date">
                                <f:facet name="header">
                                    <h:outputLabel value="Discharge Date"/> 
                                </f:facet>
                                <h:outputLabel   value="#{bip.bill.patientEncounter.dateOfDischarge}">
                                    <f:convertDateTime pattern="dd MMMM yyyy" ></f:convertDateTime>
                                </h:outputLabel>
                            </p:column>

                            <p:column headerText="Inward Charge Type">
                                <f:facet name="header">
                                    <h:outputLabel value="Inward Charge Type"/> 
                                </f:facet>
                                <h:outputLabel   value="#{bip.inwardChargeType.label}"/>
                            </p:column>
                            <p:column headerText="Total Value" styleClass="averageNumericColumn">
                                <f:facet name="header">
                                    <h:outputLabel value="Total Value"/> 
                                </f:facet>
                                <h:outputLabel  value="#{bip.grossValue}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column>                            
                            <p:column headerText="Discount Value"  styleClass="averageNumericColumn">
                                <f:facet name="header">
                                    <h:outputLabel value="Discount Value"/> 
                                </f:facet>
                                <h:outputLabel  value="#{bip.discount}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column>

                            <p:column headerText="Net Value"  styleClass="averageNumericColumn">
                                <f:facet name="header">
                                    <h:outputLabel value="Net Value"/> 
                                </f:facet>
                                <h:outputLabel  value="#{bip.netValue}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column>

                        </p:dataTable>

                    </p:panel>


                </h:form>
            </ui:define>



        </ui:composition>

    </h:body>
</html>
